import java.util.*;

public class Main12 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        List<String> lines = new ArrayList<>();
        String line;
        while (!(line = scanner.nextLine()).equals("!!!!!")) {
            if (!line.trim().isEmpty()) {
                lines.add(line);
            }
        }

        Set<String> wordSet = new HashSet<>();

        for (String text : lines) {
            String[] words = text.split("\\s+");
            for (String word : words) {
                if (!word.isEmpty()) {
                    wordSet.add(word);
                }
            }
        }

        List<String> wordList = new ArrayList<>(wordSet);
        Collections.sort(wordList);

        System.out.println(wordList.size());

        for (int i = 0; i < Math.min(10, wordList.size()); i++) {
            System.out.println(wordList.get(i));
        }

        scanner.close();
    }
}
